<script type="text/javascript">
$( function() {
	/*$('.unit').on('change', '.select', function(){
		var object = $( this );
		var id = $( this ).val();
		if( id == "" ) return;
		$.ajax({
			url : "{:U('UserRole/getRole')}",
			type : 'post',
			data : { id : id },
			dataType : 'json',
			success : function( data ){
				object.nextAll().remove();
				if ( data['status'] == 1 ) {
					if ( !data['info'] ) return;
					var data = data['info'];
					if( data.length > 0 ){
						object.removeAttr('name');
						object.removeClass('required');
						var html="<select class='select required' name='auth'>";
						html+="<option value=''>请选择</option>";
						for ( var i = 0; i < data.length; i++ ) {
							html+="<option value='"+ data[i].id +"'>"+ data[i].title +"</option>";
						}
						html+="</select>";
						//alert(html);
						object.parent().append(html);
					}
				}
			}
		});
	});*/
	$('.unit').on('change', '.select', function(){
		var object = $( this );
		var id = $( this ).val();
		if( id == 15 ) {
			$.getJSON( '__ROOT__/Public/Home/Js/data.js', function( data ) {
				var html = "";
				var obj = data['data'];
				for ( var j in obj ){
					html += "<label class=\"label_auto\">";
					html += "	<input value=\""+ obj[j]['id'] +"\" name=\"area[]\" type=\"checkbox\" />" + obj[j]['name'];
					html += "</label>";
				}
				$( '.province' ).append( html );
				$( ".areaBox" ).show();
			} );
		} else {
			//$( ".areaBox" ).hide();
			$( '.province' ).html('');
		}
	});
} );
</script>
<style type="text/css">
.province
{width:auto; height:auto; overflow:hidden;}
.pageContent .pageFormContent .province .label_auto
{width:130px; text-align:left; float:left;}
</style>
<div class="page">
	<div class="pageContent">
	    <form method="post" action="__URL__/create/" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
	        <div class="pageFormContent" layoutH="68">
	        	<div class="unit">
					<label>群组：</label>
					<select name="auth" class="required select">
		                <option value="">请选择</option>
		                <volist name="roleList" id="volist">
							<if condition="$volist['id'] == $paramter['auth']">
			                    <option value="{$volist['id']}" selected="selected">{$volist['title']}</option>
							<else />
								<option value="{$volist['id']}">{$volist['title']}</option>
							</if>
		                </volist>
		            </select>
				</div>
				<div class="unit">
					<label>用户名：</label>
					<input type="text" name="username" value="" class="required" />
				</div>
				<div class="unit">
					<label>密码：</label>
					<input type="text" name="password" value="" class="required" />
				</div>
				<div class="unit">
					<label>职权描述：</label>
					<input type="text" name="nickname" value="" class="required" />
				</div>
				<div class="unit areaBox" style="display:none;">
					<label>选择管辖区域：</label>
					<div class="province"></div>
				</div>
				<div class="unit">
					<label>描述：</label>
					<textarea name="intro" class="required"></textarea>
				</div>
				<div class="unit">
					<label>排　　序：</label>
					<input type="text" name="sort" value="0" class="required" />
				</div>
	        </div>
	        <div class="formBar">
	            <ul>
                     <li>
                        <div class="buttonSave">
                            <div class="buttonSaveContent">
                                <button type="submit">
                            		<i class="iconfont">&#xe644;</i>保存
                                </button>
                            </div>
                        </div>
                    </li>
                    <li>
                        <div class="buttonCancel">
                            <div class="buttonCancelContent">
                                <button type="button" class="close">
                                	<i class="iconfont">&#xe640;</i>取消
                                </button>
                            </div>
                        </div>
                    </li>
	            </ul>
	        </div>
	    </form>
	</div>
</div>